const { readFile } = require('node:fs/promises');
const path = require('node:path');

(async function (path) {
  try {
    // 读取文件
    const res = await readFile(path);
    console.log(`promise 读取文件`, res, res.toString());
    // 删除文件
    // await unlink(path);
    // console.log(`successfully deleted ${path}`);
  } catch (error) {
    console.error('there was an error:', error.message);
  }
})(path.resolve(__dirname, 'input.txt'));
